//
//  WeekDayTableViewCell.m
//  TableTest
//
//  Created by 众拳科技 on 2017/11/13.
//  Copyright © 2017年 众拳科技. All rights reserved.
//

#import "WeekDayTableViewCell.h"

@interface WeekDayTableViewCell()

@property(nonatomic,strong)NSMutableArray *labArray;

@end

@implementation WeekDayTableViewCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        self.labArray = [[NSMutableArray alloc] init];
        
        for (int i = 0; i <= 24; i ++) {
         
            UILabel *topLab = [[UILabel alloc] init];
            topLab.text = [NSString stringWithFormat:@"%02d:00",i];
            topLab.font = [UIFont systemFontOfSize:14];
            topLab.textColor = CSColorFromRGB(0xa5a5a5);
            [self.contentView addSubview:topLab];
            [self.labArray addObject:topLab];
        }
        
        [self setConstraints];
    }
    
    return self;
}

-(void)setConstraints{
    
    UILabel *tmpLabel;
    
    int i = 0;
    
    for (UILabel *timeLabel in self.labArray) {
        
        [timeLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
           
            if (i == 0) {
             
                make.top.mas_equalTo(self.contentView);
            }
            else if (i == 24){
                
                make.bottom.mas_equalTo(self.contentView);
            }
            else{
                
                make.top.mas_equalTo((i * ((kScreenWidth / 8) + 20)) - 6);
            }
            make.right.mas_equalTo(self.contentView).offset(-2);
        }];
        
        tmpLabel = timeLabel;
        
        i++;
    }
    
}

@end
